<?php

	$yahoo = file_get_contents("http://cn.biz.yahoo.com/fund/");
	$yahoo = str_replace("\n", "", $yahoo);	
		
	preg_match_all('/<h1 class=\"h14x\">(.+?)<\/h1>/', $yahoo, $title);
	preg_match_all('/<a href=\"http:\/\/cn.finance.yahoo.com\/q.+?\"( target=\"_blank\" name=\"biz\/biz_fund_hp0702\/paihangbang\/\")?>(.+?)<\/a>/', $yahoo, $content);
	preg_match_all('/<td class=\"bg\"><strong>(.+?)<\/strong>/', $yahoo, $note);

	yahoo_fund($title[1], $note[1], $content[2]); 

	function yahoo_fund($title, $note, $content)  
	{  
		for($s=0; $s<8; $s++)
		{	      
			$d = $s * 3;
			$e = $d + 1;
			$f = $e + 1;
			echo $title[$s];
			echo "<table border='1'>";
			echo "<tr><td width='150'>".$note[$d]."</td>";
			echo "<td width='150'>".$note[$e]."</td>";
			echo "<td width='150'>".$note[$f]."</td></tr>";
			
			for($i=0; $i<10; $i++)
			{
				$a = $s * 30 + $i * 3;
				$b = $a + 1;
				$c = $b + 1;
				echo "<tr><td width='150'>".$content[$a]."</td>";
				echo "<td width='150'>".$content[$b]."</td>";
				echo "<td width='150'>".$content[$c]."</td></tr>";
			}
	     	echo "</table></br>";
		 } 
	}  
		 
?>